package com.hongyun.tms.web.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hongyun.tms.domain.AjaxResult;
import com.hongyun.tms.entity.Dock;
import com.hongyun.tms.service.IDockService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 作业港区和码头关联表 前端控制器
 * </p>
 *
 * @author peng.li
 * @since 2024-08-14
 */
@Api(tags = "作业码头管理")
@RestController
@RequestMapping("/dock")
public class DockController {
    @Resource
    private IDockService dockService;

    @ApiOperation("码头列表")
    @GetMapping("list")
    public AjaxResult dockList(@RequestParam(value = "portAreaCode", required = false) String portAreaCode) {
        List<Dock> list = dockService.list(new LambdaQueryWrapper<Dock>()
                .eq(StringUtils.isNotBlank(portAreaCode), Dock::getPortAreaCode, portAreaCode));
        return AjaxResult.success(list);
    }
}
